import request from '@/config/axios'

// 飘窗板块 VO
export interface ImgblockVO {
  id: number // 主键
  siteId: number // 所属站点
  name: string // 名称
  imgblockCode: string // 区块标识
  imgWidth: number // 图片宽像素
  imgHeight: number // 图片高像素
  activetimeBegin: Date // 开始生效时间
  activetimeEnd: Date // 结束生效时间
  activePos: number // 生效位置(1首页  2栏目页面 )
  activeChannelId: number // 生效位置-栏目id
}

// 飘窗板块 API
export const ImgblockApi = {
  // 查询飘窗板块分页
  getImgblockPage: async (params: any) => {
    return await request.get({ url: `/cms/imgblock/page`, params })
  },

  // 查询飘窗板块详情
  getImgblock: async (id: number) => {
    return await request.get({ url: `/cms/imgblock/get?id=` + id })
  },

  // 新增飘窗板块
  createImgblock: async (data: ImgblockVO) => {
    return await request.post({ url: `/cms/imgblock/create`, data })
  },

  // 修改飘窗板块
  updateImgblock: async (data: ImgblockVO) => {
    return await request.put({ url: `/cms/imgblock/update`, data })
  },

  // 删除飘窗板块
  deleteImgblock: async (id: number) => {
    return await request.delete({ url: `/cms/imgblock/delete?id=` + id })
  },

  // 导出飘窗板块 Excel
  exportImgblock: async (params) => {
    return await request.download({ url: `/cms/imgblock/export-excel`, params })
  },
}